<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <link rel="stylesheet" type="text/css" href="./css/aui.css" />
    <link rel="stylesheet" type="text/css" href="./css/style.css" />
    <link rel="stylesheet" type="text/css" href="./css/aui-slide.css" />
    <script type="text/javascript" src="./script/jquery.min.js"></script>
    <script type="text/javascript" src="./script/api.js"></script>
    <script type="text/javascript" src="./script/base.js"></script>


</head>
<body>
<header class="aui-bar aui-bar-nav">
    <a class="aui-pull-left" onclick="closeWin()">
        <span class="aui-iconfont aui-icon-left"></span>
    </a>
    <div class="aui-title">意见反馈</div>
</header>
<div class="aui-bar-nav-d"></div>

<style>
body{background:#fff;}
</style>
<div class="feedback">
  <textarea name="" id="text"></textarea>
  <button type="button" id="sub2">提交</button>
  <button type="button" class="active" style="display:none;" id="sub" tapmode onclick="updata()">提交</button>

</div>


</body>
<script type="text/javascript">
    function closeWin(){
        api.closeWin({
        });
    }

    $('#text').on('keyup', function() {
        if ($('#text').val().length == 0) {

            $("#sub").hide();
            $("#sub2").show();
        } else {
            $("#sub").show();
            $("#sub2").hide();
        }
    });

    function updata() {

        var userid = $api.getStorage('userid');
        // !userid)
          if (!userid) {
            api.openWin({
                name: 'login',
                url: './login.html',
                pageParam: {
                    name: 'test'
                }
            });


        } else {

      var text =  $("#text").val();


     api.ajax({
         url: webAddress+'/index.php?ctl=app_user_center&act=reportguy',
         method: 'post',
         data: {
             values: {
                 user_id: userid,
                 reason:text
             },
         }
     },function(ret, err){
         if (ret.status == 1) {
             alert(ret.info);
             api.closeWin();
         } else {
             alert(ret.info);
         }
     });
        }
    };
</script>
</html>
